<template>
	<TextComponent v-if="componentModel.type=='text'" :componentModel="componentModel" :rowData="rowData">
	</TextComponent>
	<NavBarComponent v-else-if="componentModel.type=='mnavbar'" :componentModel="componentModel">
	</NavBarComponent>
	<LabelComponent v-else-if="componentModel.type=='label'" :componentModel="componentModel" :rowData="rowData">
	</LabelComponent>
	<NumberComponent v-else-if="componentModel.type=='number'" :componentModel="componentModel" :rowData="rowData">
	</NumberComponent>
	<SelectComponent v-else-if="componentModel.type=='select'" :componentModel="componentModel" :rowData="rowData">
	</SelectComponent>
	<AttributeSetInstanceComponent v-else-if="componentModel.type=='search' && componentModel.dataField=='product_attribute_set_instance_id'" :componentModel="componentModel" :rowData="rowData">
	</AttributeSetInstanceComponent>
	<SearchComponent v-else-if="componentModel.type=='search'" :componentModel="componentModel" :rowData="rowData">
	</SearchComponent>
	<DatetimeComponent v-else-if="componentModel.type=='datetime'" :componentModel="componentModel" :rowData="rowData">
	</DatetimeComponent>
	<DateComponent v-else-if="componentModel.type=='date'" :componentModel="componentModel" :rowData="rowData">
	</DateComponent>
	<TimeComponent v-else-if="componentModel.type=='time'" :componentModel="componentModel" :rowData="rowData">
	</TimeComponent>
	<ButtonComponent v-else-if="componentModel.type=='button'" :componentModel="componentModel" :rowData="rowData">
	</ButtonComponent>
	<RowComponent v-else-if="componentModel.type=='row'" :componentModel="componentModel" :rowData="rowData">
		<ComponentFactory :componentModel="childComponentModel" v-for="(childComponentModel) in componentModel.children"
			:key="childComponentModel.id" :rowData="rowData">
		</ComponentFactory>
	</RowComponent>
	<ColComponent v-else-if="componentModel.type=='col'" :componentModel="componentModel" :rowData="rowData">
		<ComponentFactory :componentModel="childComponentModel" v-for="(childComponentModel) in componentModel.children"
			:key="childComponentModel.id" :rowData="rowData">
		</ComponentFactory>
	</ColComponent>
	<TextareaComponent v-else-if="componentModel.type=='textarea'" :componentModel="componentModel" :rowData="rowData">
	</TextareaComponent>
	<HiddenComponent v-else-if="componentModel.type=='hidden'" :componentModel="componentModel" :rowData="rowData">
	</HiddenComponent>
	<DivComponent v-else-if="componentModel.type=='div'" :componentModel="componentModel" :rowData="rowData">
		<ComponentFactory :componentModel="childComponentModel" v-for="(childComponentModel) in componentModel.children"
			:key="childComponentModel.id" :rowData="rowData">
		</ComponentFactory>
	</DivComponent>
	<CheckboxComponent v-else-if="componentModel.type=='checkbox'" :componentModel="componentModel" :rowData="rowData">
	</CheckboxComponent>
	<GroupTitleComponent v-else-if="componentModel.type=='grouptitle'" :componentModel="componentModel" :rowData="rowData">
	</GroupTitleComponent>
	<div v-else-if="componentModel.type=='tabcontrol'">
		<van-tabs>
			<van-tab :componentModel="childComponentModel" :title="childComponentModel.label" v-for="(childComponentModel) in componentModel.children" :key="childComponentModel.id" :name="childComponentModel.id+''">
				<ComponentFactory :componentModel="childChildComponentModel" v-for="(childChildComponentModel) in childComponentModel.children" :key="childChildComponentModel.id" :rowData="rowData"></ComponentFactory>
			</van-tab>
		</van-tabs>
	</div>
	<ListViewComponent v-else-if="componentModel.type=='mlistview'" :componentModel="componentModel">
	</ListViewComponent>
	<ImageComponent v-else-if="componentModel.type=='image'" :componentModel="componentModel" :rowData="rowData">
	</ImageComponent>
	<SwitchComponent v-else-if="componentModel.type=='switch'" :componentModel="componentModel" :rowData="rowData">
	</SwitchComponent>
	<TagComponent v-else-if="componentModel.type=='tag'" :componentModel="componentModel" :rowData="rowData">
	</TagComponent>
	<FormulaComponent v-else-if="componentModel.type=='formula'" :componentModel="componentModel" :rowData="rowData">
	</FormulaComponent>
	<RollUpSummaryComponent v-else-if="componentModel.type=='rollupsummary'" :componentModel="componentModel" :rowData="rowData">
	</RollUpSummaryComponent>
	<LinkRecordComponent v-else-if="componentModel.type=='linkrecord'" :componentModel="componentModel" :rowData="rowData">
	</LinkRecordComponent>
	<TreePathComponent v-else-if="componentModel.type=='treepath'" :componentModel="componentModel" :rowData="rowData">
	</TreePathComponent>
	<VBarChartComponent v-else-if="componentModel.type=='vbarchart'" :componentModel="componentModel" :rowData="rowData">
	</VBarChartComponent>
	<HBarChartComponent v-else-if="componentModel.type=='hbarchart'" :componentModel="componentModel" :rowData="rowData">
	</HBarChartComponent>
	<LineChartComponent v-else-if="componentModel.type=='linechart'" :componentModel="componentModel" :rowData="rowData">
	</LineChartComponent>
	<PieChartComponent v-else-if="componentModel.type=='piechart'" :componentModel="componentModel" :rowData="rowData">
	</PieChartComponent>
	<WebSocketComponent v-else-if="componentModel.type=='websocket'" :componentModel="componentModel" :rowData="rowData">
		
	</WebSocketComponent>
	<UReport2Component v-else-if="componentModel.type=='ureport2'" :componentModel="componentModel" :rowData="rowData">
		
	</UReport2Component>
	<DashboardPageComponent v-else-if="componentModel.type=='dashboardpage'" :componentModel="componentModel" :rowData="rowData">
		
	</DashboardPageComponent>
	<DataGridComponent v-else-if="componentModel.type=='datagrid'" :componentModel="componentModel" :rowData="rowData">
		
	</DataGridComponent>
	<FilterGroupComponent v-else-if="componentModel.type=='filtergroup'" :componentModel="componentModel">
		
	</FilterGroupComponent>
	<RadioListComponent v-else-if="componentModel.type=='radiolist'" :componentModel="componentModel">
		
	</RadioListComponent>
	<CheckboxListComponent v-else-if="componentModel.type=='checkboxlist'" :componentModel="componentModel">
		
	</CheckboxListComponent>
	<WorkflowStepsComponent v-else-if="componentModel.type=='workflowsteps'" :componentModel="componentModel">
		
	</WorkflowStepsComponent>
	<GaugeComponent v-else-if="componentModel.type=='gauge'" :componentModel="componentModel">
		
	</GaugeComponent>
	<DetailReportComponent v-else-if="componentModel.type=='detailreport'" :componentModel="componentModel">
		
	</DetailReportComponent>
	<IndicatorTableComponent v-else-if="componentModel.type=='indicatortable'" :componentModel="componentModel">
		
	</IndicatorTableComponent>
	<SummaryReportComponent v-else-if="componentModel.type=='summaryreport'" :componentModel="componentModel">
		
	</SummaryReportComponent>
</template>

<script>
	import TextComponent from './TextComponent.vue';
	import NavBarComponent from './NavBarComponent.vue';
	import LabelComponent from './LabelComponent.vue';
	import NumberComponent from './NumberComponent.vue';
	import SelectComponent from './SelectComponent.vue';
	import SearchComponent from './SearchComponent.vue';
	import DatetimeComponent from './DatetimeComponent.vue';
	import DateComponent from './DateComponent.vue';
	import TimeComponent from './TimeComponent.vue';
	import ButtonComponent from './ButtonComponent.vue';
	import RowComponent from './RowComponent.vue';
	import ColComponent from './ColComponent.vue';
	import TextareaComponent from './TextareaComponent.vue';
	import HiddenComponent from './HiddenComponent.vue';
	import DivComponent from './DivComponent.vue';
	import CheckboxComponent from './CheckboxComponent.vue';
	import GroupTitleComponent from './GroupTitleComponent.vue';
	import ListViewComponent from './ListViewComponent.vue';
	import ImageComponent from './ImageComponent.vue';
	import SwitchComponent from './SwitchComponent.vue';
	import TagComponent from './TagComponent.vue';
	import FormulaComponent from './FormulaComponent.vue';
	import RollUpSummaryComponent from './RollUpSummaryComponent.vue';
	import LinkRecordComponent from './LinkRecordComponent.vue';
	import TreePathComponent from './TreePathComponent.vue';
	import VBarChartComponent from './VBarChartComponent.vue';
	import HBarChartComponent from './HBarChartComponent.vue';
	import LineChartComponent from './LineChartComponent.vue';
	import PieChartComponent from './PieChartComponent.vue';
	import WebSocketComponent from './WebSocketComponent.vue';
	import UReport2Component from './UReport2Component.vue';
	import DashboardPageComponent from './DashboardPageComponent.vue';
	import DataGridComponent from './DataGridComponent.vue';
	import FilterGroupComponent from './FilterGroupComponent.vue';
	import RadioListComponent from './RadioListComponent.vue';
	import CheckboxListComponent from './CheckboxListComponent.vue';
	import WorkflowStepsComponent from './WorkflowStepsComponent.vue';
	import AttributeSetInstanceComponent from './AttributeSetInstanceComponent.vue';
	import GaugeComponent from './GaugeComponent.vue';
	import DetailReportComponent from './DetailReportComponent.vue';
	import IndicatorTableComponent from './IndicatorTableComponent.vue';
	import SummaryReportComponent from './SummaryReportComponent.vue';
	import utils from '@/utils/utils.js';
	export default {
		name: "ComponentFactory",
		components: {
			TextComponent,NavBarComponent,LabelComponent,NumberComponent,SelectComponent,SearchComponent,
			DatetimeComponent,DateComponent,TimeComponent,ButtonComponent,RowComponent,ColComponent,
			TextareaComponent,HiddenComponent,DivComponent,CheckboxComponent,GroupTitleComponent,ListViewComponent,
			ImageComponent,SwitchComponent,TagComponent,FormulaComponent,RollUpSummaryComponent,LinkRecordComponent,
			TreePathComponent,VBarChartComponent,HBarChartComponent,LineChartComponent,PieChartComponent,
			WebSocketComponent,UReport2Component,DashboardPageComponent,DataGridComponent,
			FilterGroupComponent,RadioListComponent,CheckboxListComponent,WorkflowStepsComponent,AttributeSetInstanceComponent,
			GaugeComponent,DetailReportComponent,
			IndicatorTableComponent,
			SummaryReportComponent
		},
		props: [
			"componentModel","rowData"
		],data() {
			return {
				
			}
		},inject:['children']
		,mounted() {
			this.children.push(this);
		},beforeUnmount() {
			utils.removeArrayElement(this.children,this);
		}
	}
</script>

<style>
</style>
